package org.picommo.common;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.simpleframework.xml.ElementList;


public class CellTypeList {
	
	@ElementList
	private final List<CellType> cellTypes;
	
	public CellTypeList() {
		this(new ArrayList<CellType>());
	}
	
	public CellTypeList(List<CellType> cellTypes) {
		super();
		this.cellTypes = cellTypes;
	}

	
	public List<CellType> getList() {
		return Collections.unmodifiableList(cellTypes);
	}
	
	
	@Override
	public boolean equals(Object obj) {
		if(!(obj instanceof CellTypeList)) {
			return false;
		}
		
		CellTypeList list = (CellTypeList)obj;
		List<CellType> otherCellTypes = list.getList();
		
		if(cellTypes.size() != otherCellTypes.size()) {
			return false;
		}
		
		for(int i=0; i<cellTypes.size(); i++) {
			if(!cellTypes.get(i).equals(otherCellTypes.get(i))) {
				return false;
			}
		}
		return true;
	}

}
